<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>东单办公系统-学生资料</title>
<meta name="renderer" content="webkit">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport"
	content="width=device-width, initial-scale=1, maximum-scale=1">
<link rel="stylesheet" href="media/layui/css/layui.css" media="all">
	<script src="media/layui/layui.js"></script>
<script type="text/javascript" src="media/js/jquery.min.js"></script>
</head>
<body>
	<div class="layui-container" style="margin-top: 50px;">
		<form class="layui-form" action="staffadd.do" method="post"
			enctype="multipart/form-data">

			<div class="layui-form-item">
				<label class="layui-form-label">编号</label>
				<div class="layui-input-inline">
					<input type="text" name="no" id="f1" readonly="readonly"
						lay-verify="name" autocomplete="off" placeholder="请输入工号"
						class="layui-input">
				</div>
				<label class="layui-form-label">姓名</label>
				<div class="layui-input-inline">
					<input type="text" name="name" lay-verify="name" id="f2"
						readonly="readonly" autocomplete="off" placeholder="请输入姓名"
						class="layui-input">
				</div>
				<label class="layui-form-label">所属班级</label>
				<div class="layui-input-inline">
					<input type="text" name="gname" lay-verify="name" id="f3"
						readonly="readonly" autocomplete="off" class="layui-input">
				</div>
			</div>

			<div class="layui-form-item">
				<label class="layui-form-label">性别</label>
				<div class="layui-input-inline">
					<input type="text" name="sex" lay-verify="name" readonly="readonly"
						id="f4" autocomplete="off" class="layui-input">
				</div>
				<label class="layui-form-label">生日日期</label>
				<div class="layui-input-inline">
					<input type="text" name="birtyday" id="f5" autocomplete="off"
						readonly="readonly" class="layui-input">
				</div>
			</div>
			<div class="layui-form-item">
				<label class="layui-form-label">邮箱</label>
				<div class="layui-input-inline">
					<input type="text" name="email" lay-verify="required" id="f6"
						readonly="readonly" autocomplete="off" class="layui-input">
				</div>
				<label class="layui-form-label">手机号</label>
				<div class="layui-input-inline">
					<input type="text" name="phone" lay-verify="required" id="f7"
						readonly="readonly" autocomplete="off" class="layui-input">
				</div>
				<label class="layui-form-label">QQ</label>
				<div class="layui-input-inline">
					<input type="text" name="qq" lay-verify="required" id="f8"
						readonly="readonly" autocomplete="off" class="layui-input">
				</div>
			</div>

			<div class="layui-form-item">
				<label class="layui-form-label">毕业学校</label>
				<div class="layui-input-inline">
					<input type="text" name="schoolname" lay-verify="required" id="f9"
						readonly="readonly" autocomplete="off" class="layui-input">
				</div>
				<label class="layui-form-label">学历</label>
				<div class="layui-input-inline">
					<input type="text" name="education" lay-verify="required" id="f10"
						readonly="readonly" autocomplete="off" class="layui-input">
				</div>

			</div>
			<div class="layui-form-item">
				<!--<label class="layui-form-label">照片</label>
				<img alt="图片预览" id="ylimg" src="media/images/qf_logo.png" width="200px" height="200px" />
				<label class="layui-btn" for="f1"><i class="layui-icon">&#xe67c;</i>上传图片</label>
				<label class="layui-form-label"></label>-->
				<!--<input class="layui-btn" type="submit" value="确认修改">-->
				<!--<input type="file" name="f11" id="f11" onchange="yl(this,'ylimg')" style="display: none" />-->
			</div>
		</form>
	</div>


	<script type="text/javascript">
		//预览图片,参数说明：第一个参数：要预览的file对象，第二个参数：预览的img标签的id名称
		function yl(obj, id) {
			//FileReader
			if (window.FileReader) {//验证当前的浏览器是否支持图片预览
				var reader = new FileReader();
				var file = obj.files[0];
				var regexImage = /^image\//;//js正则表达式，匹配是否拥有image
				if (regexImage.test(file.type)) {
					//设置读取结束的回调函数
					reader.onload = function(data) {
						var img = document.getElementById(id);
						img.src = data.target.result;//将结果数据显示到img标签上

					};
					//开始读取上传的文件内容
					reader.readAsDataURL(file);
				} else {
					alert("亲，看清楚是图片预览");
					return;
				}
			} else {
				alert("亲，浏览器该升级了");

				return;
			}
		}
	</script>
	<!-- 注意：如果你直接复制所有代码到本地，上述js路径需要改成你本地的 -->
	<script>
		var form;
		layui.use([ 'form', 'layedit', 'laydate' ], function() {
			form = layui.form, layer = layui.layer, layedit = layui.layedit,
					laydate = layui.laydate;

			//日期
			laydate.render({
				elem : '#date'
			});
			laydate.render({
				elem : '#date1'
			});

			//自定义验证规则
			form.verify({
				title : function(value) {
					if (value.length < 5) {
						return '标题至少得5个字符啊';
					}
				},
				pass : [ /(.+){6,12}$/, '密码必须6到12位' ],
				content : function(value) {
					layedit.sync(editIndex);
				}
			});
		});
	</script>

	<script>
		$(function(){
			/*var no = window.location.search;
			alert(no)*/
			$.ajax({
				type: "get",
				url: "user/queryStudent.do",
				dataType: "json",
				success: function (data) {
					console.log(data)
					if (data.code == 1) {
						$("#f1").val(data.info.id)
						$("#f2").val(data.info.name)
						$("#f3").val(data.info.cname)
						$("#f4").val(data.info.sex)
						$("#f5").val(data.info.birthday)
						$("#f6").val(data.info.email)
						$("#f7").val(data.info.phone)
						$("#f8").val(data.info.qq)
						$("#f9").val(data.info.schoolname)
						$("#f10").val(data.info.education)
					} else {
						layer.msg("获取数据异常")
					}
				}
			})
		})


	</script>
</body>
</html>